package com.music.constant;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @ClassName:   EmailProperties
 * @Author:      Li ZhenYong
 * @description:  发送邮件人的信息
 * @Date:        2022-04-06 21:23
 * @Version:  1.0
 */
@Component
public class EmailProperties implements InitializingBean {

	@Value("${spring.mail.username}")
	private String from;

	public static String FROM;

	@Override
	public void afterPropertiesSet() throws Exception {
		FROM = from;
	}

	public static String getEmailContent(String code) {
		String content = String.format("您的至安生邮箱验证码为:%s,验证码十分钟内有效，请勿泄漏他人。",code);
		return "<html>\n" +
				"<body style=\"justify-content: center;display: flex;flex-direction: column;align-items: center;margin-top: 50px;\">\n" +
				"    <div>\n" +
				"        <img src=\"\"></img>\n" +
				"    </div>\n" +
				"\n" +
				"    <div>" + content +
				"</div>\n" +
				"</body>\n" +
				"</html>";
	}
}
